<!DOCTYPE html>

<html>

<head>
    <title>个人中心</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="css/PersonalCenter.css">
    <link rel="stylesheet" href="./alibaba/iconfont/iconfont.css">
    <link rel="stylesheet" href="less/css/index.css" />
</head>

<body>
    <div class="top1">
        <p ><img src="images/setting.png" alt="" width="8%" style="margin:10% 0 0 84%;"></p>
        <p id="demo" style="margin: -3% 0 0 7%;">Hi</p>
        <script>
            var myDate = new Date();//创建Date对象
            var H = myDate.getHours();//获取当前小时
            console.log(H);
            var p=document.getElementById("demo");
            if(H>=7 && H<11){
                p.innerText="Hi,上午好"
            }
            if(H>=11 && H<14){
                p.innerText="Hi,中午好"
            }
            if(H>=14 && H<18){
                p.innerText="Hi,下午好"
            }
            if(H>=18 && H<23){
                p.innerText="Hi,晚上好"
            }
            if(H>=23 && H<7){
                p.innerText="该休息了！"
            }
        </script>
    </div>
    <div class="container1">
        <!-- <header>
            <h1>页面顶端渐变效果</h1>
        </header> -->

    <!-- 2 8 9 11 14 16  -->

        <div class="block1" style="margin-top1: 5%;">
            <p>
                <!-- <span style="width: 48%;font-size: 144%;">
                <img src="../images/user.png" width="16%" alt="" style="margin-right: 8%;">
                <b>登陆/注册</b></span> -->
                <div style="width: 8%;float: left;">
                    <img src="images/user.png" width="90%" alt="">
                </div>
            <div id="user" style="float: left;margin-left: 4%;"><b><a href="autologin.html">登陆/注册</a></b></div>
            </p>
            <p></p>
            <p></p>
            <p>                
                <span style="margin-left: 12%;">1</span>
                <span>2</span>
                <span style="margin-right: 12%;">3</span>
            </p>
            <p>                
                <span>我的咨询</span>
                <span>我的卡券</span>
                <span>浏览历史</span>
            </p>
            <!-- <h2>账号信息</h2>

            <p>头像、昵称、账号信息</p> -->

        </div>
        

        <div class="block1">
            <ul>  
                <li>
                    <img src="images/wodeyuyue.png">
                    <a class="a" href="#">我的预约</a>
                </li>
                <hr/>
                <li>
                    <img src="images/wodedingdan.png">
                    <a class="a" href="#">我的订单</a>
                </li>
                <hr />
                <li>
                    <img src="images/wodefenqi.png">
                    <a class="a" href="#">我的分期</a>
                </li>
                <hr/>
                <li>
                    <img src="images/wodeyouhui.png">
                    <a class="a" href="#">我的优惠</a>
                </li>
            </ul>
        </div>

        <div class="block1">
            <ul>
                <li>
                    <img src="images/changyinggong.png">
                    <a class="a" href="#">常用工具</a>
                </li>
                <hr/>
                <li>
                    <img src="images/wodehuodong.png">
                    <a class="a" href="#">我的活动</a>
                </li>
            </ul>
        </div>

        <div class="block1">
            <ul>
                <li>
                    <img src="images/wodezixun.png">
                    <a class="a" href="#">我的咨询</a>
                </li>
                <hr/>
                <li>
                    <img src="images/bangzhuzhongxin.png">
                    <a class="a" href="#">帮助中心</a>
                </li>
            </ul>
        </div>

        <div id="index_box9">
            <div class="index_box9_content">
                <div class="box text-center" onclick="window.location.href='index.html'">
                    <span class="icon iconfont icon-shouye"></span>
                    <div class="text-center" >首页</div>
                </div>
                <div class="box text-center" onclick="window.location.href='buyCar.html'">
                    <span class="icon iconfont icon-maiche"></span>
                    <div class="text-center" >买车</div>
                </div>
                <div class="box text-center" onclick="window.location.href='rentCar.html'">
                    <span class="icon iconfont icon-zuche"></span>
                    <div class="text-center" >租车</div>
                </div>
                <div class="box text-center" onclick="window.location.href='SellCar.html'">
                    <span class="icon iconfont icon-iconfontzhizuobiaozhun023121"></span>
                    <div class="text-center" >卖车</div>
                </div>
                <div class="box text-center" style="color:#249FF4" onclick="window.location.href='PersonalCenter.html'">
                    <span class="icon iconfont icon-geren"></span>
                    <div class="text-center" >我的</div>
                </div>
            </div>

        </div></div>
    <script src="./js/jquery.min.js"></script>
    <script>
        var aTags = document.getElementsByClassName("a");
        console.log(123);
        console.log(aTags);
        for (var i = 0; i < aTags.length; i++) {
          aTags[i].addEventListener("click", function() {
          });
        }
        $(function () {
            $.ajax({
                url: "/user/getUsername",
                success: function (res) {
                    console.log(res)
                    username = res;
                    if (username == null || username== "") {
                        $("#user").html("<a href=\"autologin.html\">登陆/注册</a>");
                    }else{
                        $("#user").html("<span id='logout'>"+username+"</span>");
                    }

                },
                async: false //同步请求，只有上面好了才会接着下面
            });

            $("#logout").click(function () {
                //选择是否退出
                if (confirm("是否退出？")) {
                    $.ajax({
                        url: "/user/logout",
                        success: function (res) {
                            console.log(res)
                            if (res.code == 200) {
                                $("#user").html("<a href=\"autologin.html\">登陆/注册</a>");
                            }
                        },
                        async: false //同步请求，只有上面好了才会接着下面
                    });
                }



            })
        })


    </script>
</body>

</html>